package prv.ljw.boot.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import prv.ljw.boot.dao.TDemoRespository;
import prv.ljw.boot.domain.TDemo;

import java.util.Date;

/**
 * Created by carry on 2017/2/27.
 */
@RestController
@RequestMapping("/tdemo")
public class UserRestController {

    @Autowired
    private TDemoRespository tDemoRespository;

    @RequestMapping("/save")
    public String save(String name, Integer age, Date regDate){
        tDemoRespository.save(new TDemo(name,age,new Date()));
        return "success";
    }

    @RequestMapping("/findByName")
    public TDemo findByName(String name){
        return tDemoRespository.findByName(name);
    }
}
